{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "focus": false,
    "id": "5af7a04f-7f9f-43ec-af50-9bb83107adaa"
   },
   "outputs": [],
   "source": [
    "from chemview.gg import *\n",
    "from chemview.viewer import RepresentationViewer\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "focus": false,
    "id": "75b20e59-dafa-4f3e-81be-0501a9d3d3df",
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "from chemlab.io import datafile\n",
    "from chemlab.core import guess_bonds\n",
    "system = datafile('../tests/data/pdb1g8p.ent', format='pdb').read('system')\n",
    "# system.bonds = guess_bonds(system.r_array, system.type_array, threshold=0.01)\n",
    "system.display(kind='cartoon')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "focus": false,
    "id": "b0cf8c4d-6e29-4c9e-8029-79e5c511969b"
   },
   "outputs": [],
   "source": [
    "from chemlab.io import datafile\n",
    "system = datafile('../tests/data/pdb1g8p.ent', format='pdb').read('system')\n",
    "water = system.sub(residue_name='HOH')\n",
    "\n",
    "cartoon = GeomProteinCartoon(Aes(types=system.atom_name,\n",
    "                                 secondary_id=system.secondary_id,\n",
    "                                 secondary_type=system.secondary_structure))\n",
    "points = GeomSpheres(Aes(xyz=water.r_array, sizes=0.1, colors=0xffff00))\n",
    "# lines = GeomLines(Aes(edges=system.bonds))\n",
    "gg = ggview(Aes(xyz=system.r_array)) + cartoon + points\n",
    "tv = gg.display()\n",
    "tv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "focus": false,
    "id": "d7345921-9915-41f5-9bc2-b27cd9f1e7f8"
   },
   "outputs": [],
   "source": [
    "gg = ggview(Aes(xyz=[[0.0, 0.0, 0.0],\n",
    "                     [0.0, 0.0, 0.3],\n",
    "                     [0.0, 0.0, 0.4],\n",
    "                     [0.0, 0.0, 0.5],\n",
    "                     [0.0, 0.0, 0.6],\n",
    "                     [0.0, 0.0, 0.7]], \n",
    "                colors=[0.0, 0.1, 0.2, 0.3, 0.5, 0.6],\n",
    "                visible=np.array([False, True, True, False, True, True])))\n",
    "gg += GeomPoints() \n",
    "gg += ScaleColorsGradient(limits=[0.0, 0.6], palette='viridis')\n",
    "gg.display()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true,
    "focus": false,
    "id": "3cce4935-9ecf-47db-894c-ab5a0ffe7324"
   },
   "outputs": [],
   "source": [
    "gg = ggview(Aes(xyz=[[0.0, 0.0, 0.0],\n",
    "                     [0.0, 0.0, 0.3],\n",
    "                     [0.0, 0.0, 0.4],\n",
    "                     [0.0, 0.0, 0.5],\n",
    "                     [0.0, 0.0, 0.6],\n",
    "                     [0.0, 0.0, 0.7]], \n",
    "                colors=[0.0, 0.1, 0.2, 0.3, 0.5, 0.6],\n",
    "                sizes=0.1,\n",
    "                edges=[[0, 1], [1, 2]]))\n",
    "gg += GeomSpheres() \n",
    "gg += GeomCylinders(Aes(sizes=0.05))\n",
    "gg += ScaleColorsGradient(limits=[0.0, 0.6], palette='viridis')\n",
    "gg.display()"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "celltoolbar": "Raw Cell Format",
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
